<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>打印倒三角</title>
    <script>
        var rows = prompt('请输入你需要打印的行数：');
        var cols = prompt('请输入你需要打印的列数：');
        var str = '';
        for (var i = 1; i <= rows; i++) {   //外层循环控制行数
            for (var j = i; j <= cols; j++) {
                str = str + '★';
            }
            str = str + '\n';
        }
        console.log(str);

    </script>
</head>

<body>

</body>

</html>